const useMidware = require(':utils/useMidware')
const dataWrapper = require(':midwares/dataWrapper')
const bodyParser = require('koa-body')
const cros = require('koa2-cors')


useMidware.all('/(.*)', cros())
useMidware.all('/(.*)', async (ctx, next) =>
{
    await bodyParser({ multipart: true })(ctx, next).catch((err) =>
    {
        console.log(err)
    })
})

useMidware.post('/(.*)', dataWrapper)

useMidware.get('/', async function (ctx, next) 
{
    ctx.body = 'WELCOME'
})